package com.caldremch.calhttp;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.caldremch.calhttp.http.base.BaseRespData;
import com.caldremch.calhttp.http.callback.AbsCallback;
import com.caldremch.calhttp.service.HomeApiService;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import java.util.List;

public class MainActivity extends RxAppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                request();
            }
        });
    }

    public void request() {
        HomeApiService.getSplash(this, new AbsCallback<List<Splash>>() {

            @Override
            public void onSuccess(BaseRespData<List<Splash>> response) {
                Log.e("caldremch", "成功 = "+response.data);
            }

            @Override
            public void onError(BaseRespData<List<Splash>> response, Throwable e) {

            }


        });
    }
}
